#include <stdio.h>
#include <string.h>
int main() {
    int n = 0;
    char arr[101] = { '0' };
    int flag[3] = { 0 };

    while (scanf("%d", &n) != EOF)
    {
        for (int i = 0; i < n; i++)
        {
            scanf("%s", arr);
            int len = strlen(arr);
            if ((len < 8) || (arr[0] > '0' && arr[0] < '9'))
            {
                printf("NO\n");
                continue;
            }
            for (int i = 0; i < len; i++)
            {
                if ((arr[i] > 'A' && arr[i] < 'z') || (arr[i] > '0' && arr[i] < '9'))
                {
                    if (arr[i] > 'a' && arr[i] < 'z')
                        flag[0] = 1;
                    if (arr[i] > 'A' && arr[i] < 'Z')
                        flag[1] = 1;
                    if (arr[i] > '0' && arr[i] < '9')
                        flag[2] = 1;
                }
            }
            if (flag[0] + flag[1] + flag[2] >= 2)
            {
                printf("YES\n");
            }
            else
            {
                printf("NO\n");
            }
        }
    }
    return 0;
}



